package com.travel.service.impl;
/**
* @Title HotelServiceImpl.java
* @Package com.travel.service.impl
* @Author sixmarkblue
* @Time 2020年10月27日 上午11:20:51
* @Version 1.0
* @Description: TODO
*/

import java.util.List;

import com.travel.dao.HotelDao;
import com.travel.dao.impl.HotelDaoImpl;
import com.travel.entity.Hotel;
import com.travel.service.HotelService;
import com.travel.util.PageInfo;

public class HotelServiceImpl implements HotelService {

	// 引入HotelDao
	private HotelDao hotelDao = new HotelDaoImpl();
	
	/**
	 * 增加tab_hotel记录的方法
	 */
	@Override
	public boolean insertTalHotelSuccesOrNot(Hotel hotel) {

		int i = hotelDao.insertTabHotel(hotel);
		return i == 1 ? true : false;
	}

	@Override
	public boolean deleteFromTabHotelSuccesOrNot(int hotelId) {

		int i = hotelDao.deleteFromTabHotel(hotelId);
		return i == 1 ? true : false;
	}

	@Override
	public boolean updateTabHotelSuccessOrNot(int hotelId, Hotel hotel) {

		int i = hotelDao.updateTabHotel(hotelId, hotel);
		return i == 1 ? true : false;
	}

	@Override
	public List<Hotel> queryAllHotels() {
		
		
		List<Hotel> list = hotelDao.queryAllHotels();
		return list;
	}
	
	/**
	 * 根据当前页码、每页显示个数、酒店名查询酒店记录
	 * @param pageNum 当前页码
	 * @param pageSize 每页显示个数
	 * @param hotelName 酒店名
	 * @return 分页工具类
	 */
	@Override
	public PageInfo<Hotel> queryByPageAndName(int pageNum, int pageSize, String hotelName) {

		PageInfo<Hotel> pageInfo = hotelDao.queryByPageAndName(pageNum, pageSize, hotelName);
		return pageInfo;
	}

	@Override
	public List<Hotel> queryHotelById(int hotelId) {
		List<Hotel> list = hotelDao.queryHotelById(hotelId);
		return list;
	}

	@Override
	public boolean modifyHotelSuccessOrNot(Hotel hotel) {

		int i = hotelDao.modifyHotel(hotel);
		return i == 1 ? true : false;
	}

	@Override
	public boolean modifyHotelWithHotelPictureSuccessOrNot(Hotel hotel) {
		
		int i = hotelDao.modifyHotelWithHotelPicture(hotel);
		return i == 1 ? true : false;
	}
	
	@Override
	public List<Hotel> recommendHotels() {
		List<Hotel> list = hotelDao.recommendHotels();
		return list;
	}
}














